import os

import redis


class Config(object):
    """"""
    SECRET_KEY = os.urandom(24)

    # sqlalchemy配置信息
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:mysql@127.0.0.1:3306/ihome"
    SQLALCHEMY_TRACK_MODIFICATIONS = True

    # redis数据库配置信息
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    # 配置flask-session
    SESSION_TYPE = "redis"
    SECRET_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    PERMANENT_SESSION_LIFETIME = 86400


class DevelopmentConfig(Config):
    """"""
    DEBUG = True


class ProductionConfig(Config):
    pass

config_map = {
    "develop": DevelopmentConfig,
    "product": ProductionConfig
}
